# -*- coding: UTF-8 -*-
"""
@项目名称：rmq_config.py
@作   者：陆地起飞全靠浪
@创建日期：2025-09-12-17:08
"""
import json
import os
from loguru import logger

'''
cd /sdb1/ideaProjects/AIDDserver/Control/RabbitMQ
docker-compose -p rabbitmq -f rabbitmq-compose.yml up -d
rabbitmqctl add_user aidd aidd@%#  # 创建用户
rabbitmqctl set_user_tags root administrator  # 设置为管理员权限
./用户权限vhost等设置.pdf
'''
# code_parent_dir = os.path.abspath(__file__).split('/AIDD_Control')[0]
# config_file_path = os.path.join(code_parent_dir, '../../GenerateModel/config.json')
config_file_path = '../config.json'

with open(config_file_path) as json_file:
    lines = json_file.readlines()
cfg = json.loads(''.join(lines))

log_format = "{time:YYYY-MM-DD HH:mm:ss.SSS} | {level:<8} | {name}:{function}:{line} - {message}"
# sink无需手动创建文件夹 # rotation=每天循环or轮换？Rotate daily # retention=Keep logs for 7 days
logger.add(sink=os.path.join(cfg['generate_result_path'], "../logs/AIDD_Control/log_{time}.log"), format=log_format, rotation="1 day", retention="7 days", level="DEBUG")
